package 笔试.OPPO;

import java.util.ArrayList;
import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class 选数概率 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int h = in.nextInt();
        int w = in.nextInt();
        in.nextLine();
        char[][] chs = new char[h][w];
        for (int i = 0; i < h; i++) {
            String line = in.nextLine();
            chs[i] = line.toCharArray();
        }
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < chs.length; i++) {
            int cur = 1;
            for (int j = 0; j < chs[i].length - 1; j++) {
                char ch = chs[i][j];
                char ch1 = chs[i][j + 1];
                if (ch != ch1) {
                    cur++;
                }
            }
            list.add(cur);
        }
        int fenzi = 1;
        int fenmu = 1;
        int dis = h * w;
        for (int i = 0; i < list.size(); i++) {
            Integer integer = list.get(i);
            fenzi *= integer;
            fenmu *= dis;
        }
        fenzi *= list.size();
        int div = lgc(fenzi, fenmu);
        System.out.printf("%d/%d", fenzi / div, fenmu / div);
    }

    public static int lgc(int x, int y) {
        if (y == 0) return x;
        return lgc(y, x % y);
    }
}